﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Jarvis.Sensors
{
    class DriveSensor : Sensor
    {
        public DriveSensor()
            : base(1000)
        {
            this.name = "Drive Sensor";
        }

        public override void Sense(Object stateInfo)
        {
            DriveInfo[] drives = DriveInfo.GetDrives();

            List<Object> drive_list = new List<Object>();

            foreach (DriveInfo drive in drives)
            {
                if (drive.IsReady)
                {
                    string drive_desc = drive.Name;

                    if (drive.VolumeLabel != null)
                        drive_desc = drive.VolumeLabel + " (" + drive.Name + ")";

                    drive_list.Add(drive_desc);
                }
            }

            this.log(drive_list);
        }
    }
}
